package cn.platform.response;


import com.github.pagehelper.Page;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageResult<T> {
    private Long total;
    private List<T> list;


    //新加的
    // 构造方法1：使用PageHelper的Page对象
    public PageResult(Page<T> page) {
        this.list = page.getResult();
        this.total = page.getTotal();
    }

    // 构造方法2：使用普通List和总记录数
    public PageResult(List<T> list, long total) {
        this.list = list;
        this.total = total;
    }

}
